﻿using System;
using UnityEngine;

namespace Utility
{
	// Token: 0x02000407 RID: 1031
	public class Tween
	{
		// Token: 0x060019AB RID: 6571 RVA: 0x000A56A4 File Offset: 0x000A38A4
		public static float Spring(float now, float goal, float K, float sec, float minSpeed = 0f, float maxSpeed = 0f)
		{
			float num = goal - now;
			float num2 = num * K * sec;
			if (Mathf.Abs(num) <= Mathf.Abs(num2))
			{
				return goal;
			}
			if (maxSpeed > 0f)
			{
				float num3 = maxSpeed * sec;
				if (Mathf.Abs(num2) > num3)
				{
					num2 = ((num2 < 0f) ? (-num3) : num3);
				}
			}
			if (minSpeed > 0f)
			{
				float num4 = minSpeed * sec;
				if (Mathf.Abs(num2) < num4)
				{
					num2 = ((num2 < 0f) ? (-num4) : num4);
				}
			}
			return now + num2;
		}

		// Token: 0x060019AC RID: 6572 RVA: 0x000A5734 File Offset: 0x000A3934
		public static float Linear(float nowTime, float endTime, float startVal, float changeVal)
		{
			return changeVal * nowTime / endTime + startVal;
		}

		// Token: 0x060019AD RID: 6573 RVA: 0x000A5740 File Offset: 0x000A3940
		public static float LinearMove(float now, float goal, float move)
		{
			float num = goal - now;
			if (Mathf.Abs(num) <= move)
			{
				return goal;
			}
			if (num < 0f)
			{
				return now - move;
			}
			return now + move;
		}

		// Token: 0x060019AE RID: 6574 RVA: 0x000A5774 File Offset: 0x000A3974
		public static float EasyInQuad(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime;
			return changeVal * nowTime * nowTime + startVal;
		}

		// Token: 0x060019AF RID: 6575 RVA: 0x000A5784 File Offset: 0x000A3984
		public static float EasyOutQuad(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime;
			return -changeVal * nowTime * (nowTime - 2f) + startVal;
		}

		// Token: 0x060019B0 RID: 6576 RVA: 0x000A579C File Offset: 0x000A399C
		public static float Quad(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime / 2f;
			if (nowTime < 1f)
			{
				return changeVal / 2f * nowTime * nowTime + startVal;
			}
			nowTime -= 1f;
			return -changeVal / 2f * (nowTime * (nowTime - 2f) - 1f) + startVal;
		}

		// Token: 0x060019B1 RID: 6577 RVA: 0x000A57F0 File Offset: 0x000A39F0
		public static float EasyInCubic(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime;
			return changeVal * nowTime * nowTime * nowTime + startVal;
		}

		// Token: 0x060019B2 RID: 6578 RVA: 0x000A5800 File Offset: 0x000A3A00
		public static float EasyOutCubic(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime;
			nowTime -= 1f;
			return changeVal * (nowTime * nowTime * nowTime + 1f) + startVal;
		}

		// Token: 0x060019B3 RID: 6579 RVA: 0x000A5820 File Offset: 0x000A3A20
		public static float Cubic(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime / 2f;
			if (nowTime < 1f)
			{
				return changeVal / 2f * nowTime * nowTime * nowTime + startVal;
			}
			nowTime -= 2f;
			return changeVal / 2f * (nowTime * nowTime * nowTime + 2f) + startVal;
		}

		// Token: 0x060019B4 RID: 6580 RVA: 0x000A5874 File Offset: 0x000A3A74
		public static float EasyInQuart(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime;
			return changeVal * nowTime * nowTime * nowTime * nowTime + startVal;
		}

		// Token: 0x060019B5 RID: 6581 RVA: 0x000A5888 File Offset: 0x000A3A88
		public static float EasyOutQuart(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime;
			nowTime -= 1f;
			return -changeVal * (nowTime * nowTime * nowTime * nowTime - 1f) + startVal;
		}

		// Token: 0x060019B6 RID: 6582 RVA: 0x000A58AC File Offset: 0x000A3AAC
		public static float Quart(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime / 2f;
			if (nowTime < 1f)
			{
				return changeVal / 2f * nowTime * nowTime * nowTime * nowTime + startVal;
			}
			nowTime -= 2f;
			return -changeVal / 2f * (nowTime * nowTime * nowTime * nowTime - 2f) + startVal;
		}

		// Token: 0x060019B7 RID: 6583 RVA: 0x000A5904 File Offset: 0x000A3B04
		public static float EasyInQuint(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime;
			return changeVal * nowTime * nowTime * nowTime * nowTime * nowTime + startVal;
		}

		// Token: 0x060019B8 RID: 6584 RVA: 0x000A5918 File Offset: 0x000A3B18
		public static float EasyOutQuint(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime;
			nowTime -= 1f;
			return changeVal * (nowTime * nowTime * nowTime * nowTime * nowTime + 1f) + startVal;
		}

		// Token: 0x060019B9 RID: 6585 RVA: 0x000A593C File Offset: 0x000A3B3C
		public static float Quint(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime / 2f;
			if (nowTime < 1f)
			{
				return changeVal / 2f * nowTime * nowTime * nowTime * nowTime * nowTime + startVal;
			}
			nowTime -= 2f;
			return changeVal / 2f * (nowTime * nowTime * nowTime * nowTime * nowTime + 2f) + startVal;
		}

		// Token: 0x060019BA RID: 6586 RVA: 0x000A5998 File Offset: 0x000A3B98
		public static float EasyInSine(float nowTime, float endTime, float startVal, float changeVal)
		{
			return -changeVal * Mathf.Cos(nowTime / endTime * 1.5707964f) + changeVal + startVal;
		}

		// Token: 0x060019BB RID: 6587 RVA: 0x000A59B0 File Offset: 0x000A3BB0
		public static float EasyOutSine(float nowTime, float endTime, float startVal, float changeVal)
		{
			return changeVal * Mathf.Sin(nowTime / endTime * 1.5707964f) + startVal;
		}

		// Token: 0x060019BC RID: 6588 RVA: 0x000A59C8 File Offset: 0x000A3BC8
		public static float Sine(float nowTime, float endTime, float startVal, float changeVal)
		{
			return -changeVal / 2f * (Mathf.Cos(3.1415927f * nowTime / endTime) - 1f) + startVal;
		}

		// Token: 0x060019BD RID: 6589 RVA: 0x000A59EC File Offset: 0x000A3BEC
		public static float EasyInExpo(float nowTime, float endTime, float startVal, float changeVal)
		{
			return changeVal * Mathf.Pow(2f, 10f * (nowTime / endTime - 1f)) + startVal;
		}

		// Token: 0x060019BE RID: 6590 RVA: 0x000A5A0C File Offset: 0x000A3C0C
		public static float EasyOutExpo(float nowTime, float endTime, float startVal, float changeVal)
		{
			return changeVal * (-Mathf.Pow(2f, -10f * nowTime / endTime) + 1f) + startVal;
		}

		// Token: 0x060019BF RID: 6591 RVA: 0x000A5A2C File Offset: 0x000A3C2C
		public static float Expo(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime / 2f;
			if (nowTime < 1f)
			{
				return changeVal / 2f * Mathf.Pow(2f, 10f * (nowTime - 1f)) + startVal;
			}
			nowTime -= 1f;
			return changeVal / 2f * (-Mathf.Pow(2f, -10f * nowTime) + 2f) + startVal;
		}

		// Token: 0x060019C0 RID: 6592 RVA: 0x000A5A9C File Offset: 0x000A3C9C
		public static float EasyInCirc(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime;
			return -changeVal * (Mathf.Sqrt(1f - nowTime * nowTime) - 1f) + startVal;
		}

		// Token: 0x060019C1 RID: 6593 RVA: 0x000A5ABC File Offset: 0x000A3CBC
		public static float EasyOutCirc(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime;
			nowTime -= 1f;
			return changeVal * Mathf.Sqrt(1f - nowTime * nowTime) + startVal;
		}

		// Token: 0x060019C2 RID: 6594 RVA: 0x000A5AE0 File Offset: 0x000A3CE0
		public static float Circ(float nowTime, float endTime, float startVal, float changeVal)
		{
			nowTime /= endTime / 2f;
			if (nowTime < 1f)
			{
				return -changeVal / 2f * (Mathf.Sqrt(1f - nowTime * nowTime) - 1f) + startVal;
			}
			nowTime -= 2f;
			return changeVal / 2f * (Mathf.Sqrt(1f - nowTime * nowTime) + 1f) + startVal;
		}
	}
}
